	<%@ include file="common.jsp" %>  
	<%@ include file="loadJsAndCss.jsp" %>
    
<script type="text/javascript">
	$(document).ready(function() {
		enableDatepicker('startDate','dd-mm-yy');
		enableDatepicker('endDate','dd-mm-yy');
// 		$("#reportForm").attr("action",'<c:url value="/generateReport.htm"></c:url>');
	});
	function checkFormValidations(){
		var i;
		var finalResult = true;
		var companySelected = false;
		var valuationMethodSelected = false;
		var reportTypeSelected = false;
		var error = "";
		
		if(document.forms[0].startDate.value == ""){
			error = error + "Enter Start Date" + "\n";
			finalResult = false;
		}
		if(document.forms[0].endDate.value == ""){
			error = error + "Enter End Date" + "\n";
			finalResult = false;
		}
		
		for (i=0;i<document.forms[0].companyName.length;i++) {
			if (document.forms[0].companyName[i].checked) {
				companySelected = true;
				break;
			}
		}
		if(companySelected == false){
			error = error + "Select Company" + "\n";
			finalResult = false;
		}
		for (i=0;i<document.forms[0].valuationMethod.length;i++) {
			if (document.forms[0].valuationMethod[i].checked) {
				valuationMethodSelected = true;
				break;
			}
		}
		if(valuationMethodSelected == false){
			error = error + "Select Valuation Method" + "\n";
			finalResult = false;
		}
		for (i=0;i<document.forms[0].reportType.length;i++) {
			if (document.forms[0].reportType[i].checked) {
				reportTypeSelected = true;
				break;
			}
		}
		if(reportTypeSelected == false){
			error = error + "Select Report Type" + "\n";
			finalResult = false;
		}
		if(error != ""){
			alert(error);
			return finalResult;
		}
		
		
		
			document.forms[0].submit();
		
	}
</script>


<form:form commandName="reportGenerateForm" method="POST" action="generateReport.htm" onsubmit="return false;"> 
		<form:hidden path="reportCategory"/>
	<table class="viewDetails">
		<tr class="heading">
			<td colspan="2"> Store Ledger: </td>
		</tr>
		<tr class="even">
			<td> <form:label path="invType">Inventory Type:</form:label> </td>
			<td>
				<form:select path="invType">
					<form:option value="All">All</form:option>
					<form:option value="PARTS">PARTS</form:option>
					<form:option value="DM">DM</form:option>
					<form:option value="CKD-IMPORTED">CKD-IMPORTED</form:option>
					<form:option value="CKDL">CKD-Local</form:option>
					<form:option value="AS">AS</form:option>
					<form:option value="STEEL-MANUFACTURING">STEEL-MANUFACTURING</form:option>
					<form:option value="STEEL-TRADING">STEEL-TRADING</form:option>
					<form:option value="PCC">PCC</form:option>
					<form:option value="MACHINERYS">Machinery-Spares</form:option>
					<form:option value="SPARES">SPARES</form:option>
					<form:option value="SPAREP">Spare Parts</form:option>
				</form:select>
			</td>
		</tr>
		<tr class="odd">
			<td> <form:label path="purchaseType">Purchase Type:</form:label> </td>
			<td>
				<form:select path="purchaseType">
					<form:option value="All">All</form:option>
					<form:option value="Import">Import</form:option>
					<form:option value="Local">Local</form:option>
				</form:select>
			</td>
		</tr>
		<tr class="even">
			<td> <form:label path="transactionType">Activity Type:</form:label> </td>
			<td>
				<form:select path="transactionType">
					<form:option value="All">All</form:option>
					<form:option value="CONS">CONS</form:option>
					<form:option value="FOC">FOC</form:option>
					<form:option value="RTV">RTV</form:option>
					<form:option value="SCRAP">SCRAP</form:option>
					<form:option value="CAPTIVE">CAPTIVE</form:option>
					<form:option value="SALES">SALES</form:option>
					<form:option value="ZGRIR">ZGRIR</form:option>
					<form:option value="CUSTOM">CUSTOM</form:option>
					<form:option value="COSTPRICE">COSTPRICE</form:option>
					<form:option value="RETRO">RETRO</form:option>
					<form:option value="FOREX">FOREX</form:option>
					<form:option value="INVADJ">INVADJ</form:option>
					<form:option value="OPENING">OPENING</form:option>
				</form:select>
			</td>
		</tr>
		<tr class="odd">
			<td> <form:label path="accountType">Account Type:</form:label> </td>
			<td>
				<form:select path="accountType">
					<form:option value="All">All</form:option>
<%-- 					<form:option value="RCPT ADJ">RCPT ADJ</form:option> --%>
					<form:option value="RECEIPT">RECEIPT</form:option>	<!-- Changed by Ashish as told by shubh kirti on 06 June 2012  -->	
					<form:option value="CONSUMPTION">CONSUMPTION</form:option>
				</form:select>
			</td>
		</tr>
		<tr class="even">
			<td> <form:label path="companyName">Company Name: * </form:label> </td>
			<td>
				<form:radiobutton path="companyName" value="NMIPL"/><label class="text"> NMIPL </label> 
				<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
				<form:radiobutton path="companyName" value="RNAIPL"/><label class="text"> RNAIPL </label>
				
			</td>
		</tr>
		<tr class="odd">
			<td> <form:label path="startDate">Start Date: * </form:label> </td>
			<td> <form:input path="startDate" id="startDate" cssClass="input"/>
				 <form:errors path="startDate"></form:errors> </td>
		</tr>
		<tr class="even">
			<td> <form:label path="endDate">End Date: * </form:label> </td>
			<td> <form:input path="endDate" id="endDate" cssClass="input"/></td>
		</tr>
		<tr class="odd">
			<td> <form:label path="lastPartId">Part Id:</form:label> </td>
			<td> <form:input path="lastPartId"/> </td>
		</tr>
		<tr class="even">
			<td> <form:label path="valuationMethod">Valuation Method: * </form:label> </td>
			<td>
				<form:radiobutton path="valuationMethod" value="FIFO"/><label class="text"> FIFO </label><br/>
				<form:radiobutton path="valuationMethod" value="WAC"/><label class="text"> WAC </label> <br/>
				<form:radiobutton path="valuationMethod" value="WACHybrid"/><label class="text"> WAC - Hybrid </label>
			</td>
		</tr>
		<tr class="odd">
			<td> <form:label path="reportType">Report Type: * </form:label> </td>
			<td>
				<form:radiobutton path="reportType" value="Summary-PartWise"/><label class="text"> Summary - Part Wise </label> <br>
				<form:radiobutton path="reportType" value="Summary-InventoryTypeWise"/><label class="text"> Summary - Inventory Type Wise</label><br/>
				<form:radiobutton path="reportType" value="Detailed"/><label class="text"> Detailed </label>
			</td>
		</tr>
		<tr class="even">
			<td>  <form:label path="email">Notification email Id: </form:label> </td>
			<td>
				<form:input path="email"/>
			</td>
		</tr>
		<tr class="odd">
			<td colspan="2" align="center">
				<input type="button" value="Generate Report" onclick="checkFormValidations();">
			</td>
		</tr>
	</table>
</form:form>